package Client;

import javax.swing.SwingUtilities;

import ClientNet.ClientNet;
import ClientUI.ClientGUI;
import ClientUI.LoginFrame;
import Protocol.user.BasePersonInfo;
import Protocol.utility.NetAddress;

public class Client {
	
	private ClientGUI          clientGui;
	private ClientData		   clientData;	
	private ClientNet		   clientNet;	
	private boolean            isOnline;
	
	public static void main(String[] args) {
		Client   client= new Client();
	}
	public Client() {
		clientData = new ClientData(this);
		clientGui = new ClientGUI(this);
		clientNet = new ClientNet(this);
		config();
		init();
		clientGui.go();
	}
	
	public ClientNet getClientNet() {
		return clientNet;
	}
	
	public void setClientNet(ClientNet clientNet) {
		this.clientNet = clientNet;
	}
	
	private void config() {
		BasePersonInfo   serverBasic = new BasePersonInfo();
		serverBasic.setName("server");
		serverBasic.setUser_id(-1);
		NetAddress		 serverAddress = new NetAddress();
		serverAddress.setIp("192.168.63.21");
		serverAddress.setPort(5555);
		serverBasic.setNetAddress(serverAddress);
		clientData.setServer_basic(serverBasic);	
	}
	
	private void init() {
		isOnline = false ;
	}
	
	public boolean isOnline() {
		return isOnline;
	}
	public void setOnline(boolean isOnline) {
		this.isOnline = isOnline;
	}
	public ClientGUI getClientGui() {
		return clientGui;
	}
	public void setClientGui(ClientGUI window) {
		this.clientGui = window;
	}
	public ClientData getClientData() {
		return clientData;
	}
	public void setClientData(ClientData clientData) {
		this.clientData = clientData;
	}
}
